package com.relanet.dao.impl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import org.apache.log4j.Logger;

/**
 * 基类DAO，所有DAO都必须继承此类
 * @author buzc
 * @since 2011-6-2
 */
public class BaseDao {
	Logger logger = Logger.getLogger(BaseDao.class);
	protected Connection conn;
	protected PreparedStatement psmt;
	protected ResultSet rs;
	protected String sql;
	
	/**
	 * 关掉连接
	 */
	public void close() {
		try {
			if (rs != null) {
				rs.close();
				rs = null;
			}
			if (psmt != null) {
				psmt.close();
				psmt = null;
			}
			if (conn != null) {
				conn.close();
				conn = null;
			}
		} catch (SQLException e) {
			logger.error(e.getMessage());
		}
	}
}
